<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: ailayer_batch_normalization.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('ailayer__batch__normalization_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">ailayer_batch_normalization.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="ailayer__batch__normalization_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;<span class="preprocessor">#ifndef AILAYER_BATCH_NORM</span></div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;<span class="preprocessor">#define AILAYER_BATCH_NORM</span></div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="preprocessor">#define AIFES_CHANNELS_FIRST    1</span></div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="preprocessor">#define AIFES_CHANNELS_LAST     -1</span></div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160; </div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="aifes__core_8h.html">core/aifes_core.h</a>&quot;</span></div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="aimath__f32__default_8h.html">basic/default/aimath/aimath_f32_default.h</a>&quot;</span></div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160; </div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structailayer__batch__norm.html">ailayer_batch_norm</a>   <a class="code" href="structailayer__batch__norm.html">ailayer_batch_norm_t</a>;</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html">   75</a></span>&#160;<span class="keyword">struct </span><a class="code" href="structailayer__batch__norm.html">ailayer_batch_norm</a> {</div>
<div class="line"><a name="l00076"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#ab13782a46e3804246bf82a92955096b3">   76</a></span>&#160;    <a class="code" href="structailayer.html">ailayer_t</a> <a class="code" href="structailayer__batch__norm.html#ab13782a46e3804246bf82a92955096b3">base</a>; </div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">   84</a></span>&#160;    int8_t <a class="code" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>; </div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a4be2a7d03bb9aeca3a064739b167098a">   85</a></span>&#160;    <span class="keywordtype">void</span> *<a class="code" href="structailayer__batch__norm.html#a4be2a7d03bb9aeca3a064739b167098a">momentum</a>; </div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">   86</a></span>&#160;    <span class="keywordtype">void</span> *<a class="code" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">eps</a>; </div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160; </div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a88bc32827b45ca03a858d6dbc85b9a48">   93</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> <a class="code" href="structailayer__batch__norm.html#a88bc32827b45ca03a858d6dbc85b9a48">betas</a>; </div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a81edfab4c4a52c6537f3f0ee19a0d2a4">   94</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> <a class="code" href="structailayer__batch__norm.html#a81edfab4c4a52c6537f3f0ee19a0d2a4">gammas</a>; </div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#ae61aaf16d54970d405095a058b233656">   96</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> <a class="code" href="structailayer__batch__norm.html#ae61aaf16d54970d405095a058b233656">moving_means</a>; </div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#ab30bca8df727bfc450468830d31adf1c">   97</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> <a class="code" href="structailayer__batch__norm.html#ab30bca8df727bfc450468830d31adf1c">moving_variances</a>; </div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#afcc6c64ff572ae7408fe1c4bcfe7b9d1">   99</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#afcc6c64ff572ae7408fe1c4bcfe7b9d1">trainable_params</a>[2]; </div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a33b189c78566d57ad498dbf2cc364917">  100</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#a33b189c78566d57ad498dbf2cc364917">gradients</a>[2]; </div>
<div class="line"><a name="l00101"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a590c48e998a8a740439e38d0aa4302dd">  101</a></span>&#160;    <span class="keywordtype">void</span> *<a class="code" href="structailayer__batch__norm.html#a590c48e998a8a740439e38d0aa4302dd">optimem</a>[2]; </div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a0d74b4e482c87c09c71d74cce56ba157">  109</a></span>&#160;    uint16_t <a class="code" href="structailayer__batch__norm.html#a0d74b4e482c87c09c71d74cce56ba157">parameter_shape</a>[1]; </div>
<div class="line"><a name="l00111"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">  111</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>; </div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">  112</a></span>&#160;    <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">variances</a>; </div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160; </div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00131"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a7a06fdbdd9e5f95ddc00f8bf65297f65">  131</a></span>&#160;    void (*<a class="code" href="structailayer__batch__norm.html#a7a06fdbdd9e5f95ddc00f8bf65297f65">empirical_mean_channelwise</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="code" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>);</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160; </div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a05a2db6bf3cc2160f0b13c6cb3e31a18">  145</a></span>&#160;    void (*<a class="code" href="structailayer__batch__norm.html#a05a2db6bf3cc2160f0b13c6cb3e31a18">empirical_variance_channelwise</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *x, int8_t <a class="code" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>, <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">variances</a>);</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160; </div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#ac42e8741878f9c5f21fa033e8dc344c4">  158</a></span>&#160;    void (*<a class="code" href="structailayer__batch__norm.html#ac42e8741878f9c5f21fa033e8dc344c4">exponential_moving_average</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *new_data, <span class="keyword">const</span> <span class="keywordtype">void</span> *<a class="code" href="structailayer__batch__norm.html#a4be2a7d03bb9aeca3a064739b167098a">momentum</a>, <a class="code" href="structaitensor.html">aitensor_t</a> *average);</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160; </div>
<div class="line"><a name="l00176"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a5db4592396e5ab43fc55de673c318aae">  176</a></span>&#160;    void (*<a class="code" href="structailayer__batch__norm.html#a5db4592396e5ab43fc55de673c318aae">batch_norm</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *x,</div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;                       int8_t <a class="code" href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>,</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;                       <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>,</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;                       <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">variances</a>,</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;                       <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *offsets,</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;                       <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *scales,</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;                       <span class="keyword">const</span> <span class="keywordtype">void</span> *<a class="code" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">eps</a>,</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;                       <a class="code" href="structaitensor.html">aitensor_t</a> *result);</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160; </div>
<div class="line"><a name="l00204"></a><span class="lineno"><a class="line" href="structailayer__batch__norm.html#a3f31c6b5eadced42f76d88aac2fbe5b6">  204</a></span>&#160;    void (*<a class="code" href="structailayer__batch__norm.html#a3f31c6b5eadced42f76d88aac2fbe5b6">d_batch_norm</a>)(<span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *x_in,</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;                         int8_t axis,</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160;                         <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">means</a>,</div>
<div class="line"><a name="l00207"></a><span class="lineno">  207</span>&#160;                         <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *vars,</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;                         <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#a88bc32827b45ca03a858d6dbc85b9a48">betas</a>,</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;                         <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *<a class="code" href="structailayer__batch__norm.html#a81edfab4c4a52c6537f3f0ee19a0d2a4">gammas</a>,</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160;                         <span class="keyword">const</span> <a class="code" href="structaitensor.html">aitensor_t</a> *delta_out,</div>
<div class="line"><a name="l00211"></a><span class="lineno">  211</span>&#160;                         <span class="keyword">const</span> <span class="keywordtype">void</span> *<a class="code" href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">eps</a>,</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;                         <a class="code" href="structaitensor.html">aitensor_t</a> *delta_in,</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;                         <a class="code" href="structaitensor.html">aitensor_t</a> *d_betas,</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;                         <a class="code" href="structaitensor.html">aitensor_t</a> *d_gammas);</div>
<div class="line"><a name="l00215"></a><span class="lineno">  215</span>&#160; </div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;};</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160; </div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160;<span class="keyword">extern</span> <span class="keyword">const</span> <a class="code" href="structaicore__layertype.html">aicore_layertype_t</a> *<a class="code" href="ailayer__batch__normalization_8h.html#af4710b2aa83d5e84bfbe259cd511f6d7">ailayer_batch_norm_type</a>;</div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160; </div>
<div class="line"><a name="l00237"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#a43542b80dbaf9d65f72251d938dd0d84">  237</a></span>&#160;<a class="code" href="structailayer.html">ailayer_t</a> *<a class="code" href="ailayer__batch__normalization_8h.html#a43542b80dbaf9d65f72251d938dd0d84">ailayer_batch_norm</a>(<a class="code" href="structailayer__batch__norm.html">ailayer_batch_norm_t</a> *layer, <a class="code" href="structailayer.html">ailayer_t</a> *input_layer);</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160; </div>
<div class="line"><a name="l00273"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#a4143200f8e1c9a9ee8a4292c91c6adb4">  273</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__batch__normalization_8h.html#a4143200f8e1c9a9ee8a4292c91c6adb4">ailayer_batch_norm_forward</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00274"></a><span class="lineno">  274</span>&#160; </div>
<div class="line"><a name="l00292"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#a23613b98279575ed47e067fb92c195fa">  292</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__batch__normalization_8h.html#a23613b98279575ed47e067fb92c195fa">ailayer_batch_norm_backward</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160; </div>
<div class="line"><a name="l00302"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#aeae1413817112d97e2c6148780e23624">  302</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__batch__normalization_8h.html#aeae1413817112d97e2c6148780e23624">ailayer_batch_norm_calc_result_shape</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160; </div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160; </div>
<div class="line"><a name="l00316"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#aca69f294f48ca9f4c474d3a75d5bb5b4">  316</a></span>&#160;uint32_t <a class="code" href="ailayer__batch__normalization_8h.html#aca69f294f48ca9f4c474d3a75d5bb5b4">ailayer_batch_norm_sizeof_paramem</a>(<span class="keyword">const</span> <a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160; </div>
<div class="line"><a name="l00329"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#ae3476d9d38ffe89b267e68b1c3fc748d">  329</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__batch__normalization_8h.html#ae3476d9d38ffe89b267e68b1c3fc748d">ailayer_batch_norm_set_paramem</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>, <span class="keywordtype">void</span> *memory_ptr);</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160; </div>
<div class="line"><a name="l00342"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#a39b286297ae7e1163676e98b4c9d21ea">  342</a></span>&#160;uint32_t <a class="code" href="ailayer__batch__normalization_8h.html#a39b286297ae7e1163676e98b4c9d21ea">ailayer_batch_norm_sizeof_trainmem</a>(<span class="keyword">const</span> <a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160; </div>
<div class="line"><a name="l00353"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#a7047892ab2ce5b21a2581f47d8b43c60">  353</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__batch__normalization_8h.html#a7047892ab2ce5b21a2581f47d8b43c60">ailayer_batch_norm_set_trainmem</a>(<a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>, <span class="keywordtype">void</span> *memory_ptr);</div>
<div class="line"><a name="l00354"></a><span class="lineno">  354</span>&#160; </div>
<div class="line"><a name="l00355"></a><span class="lineno">  355</span>&#160;<span class="preprocessor">#ifdef AIDEBUG_PRINT_MODULE_SPECS</span></div>
<div class="line"><a name="l00360"></a><span class="lineno"><a class="line" href="ailayer__batch__normalization_8h.html#aa314fea512774e4b63bc25da3b030476">  360</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="ailayer__batch__normalization_8h.html#aa314fea512774e4b63bc25da3b030476">ailayer_batch_norm_print_specs</a>(<span class="keyword">const</span> <a class="code" href="structailayer.html">ailayer_t</a> *<span class="keyword">self</span>);</div>
<div class="line"><a name="l00361"></a><span class="lineno">  361</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// AIDEBUG_PRINT_MODULE_SPECS</span></div>
<div class="line"><a name="l00362"></a><span class="lineno">  362</span>&#160; </div>
<div class="line"><a name="l00363"></a><span class="lineno">  363</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// AILAYER_BATCH_NORM</span></div>
<div class="ttc" id="aaifes__core_8h_html"><div class="ttname"><a href="aifes__core_8h.html">aifes_core.h</a></div><div class="ttdoc">AIfES 2 core interface.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_a23613b98279575ed47e067fb92c195fa"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#a23613b98279575ed47e067fb92c195fa">ailayer_batch_norm_backward</a></div><div class="ttdeci">void ailayer_batch_norm_backward(ailayer_t *self)</div><div class="ttdoc">Calculate the backward pass for the given Batch Normalization layer.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_a39b286297ae7e1163676e98b4c9d21ea"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#a39b286297ae7e1163676e98b4c9d21ea">ailayer_batch_norm_sizeof_trainmem</a></div><div class="ttdeci">uint32_t ailayer_batch_norm_sizeof_trainmem(const ailayer_t *self)</div><div class="ttdoc">Calculate and return the memory size needed by this layer for training.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_a4143200f8e1c9a9ee8a4292c91c6adb4"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#a4143200f8e1c9a9ee8a4292c91c6adb4">ailayer_batch_norm_forward</a></div><div class="ttdeci">void ailayer_batch_norm_forward(ailayer_t *self)</div><div class="ttdoc">Calculate the forward pass for given Batch Normalization layer.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_a43542b80dbaf9d65f72251d938dd0d84"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#a43542b80dbaf9d65f72251d938dd0d84">ailayer_batch_norm</a></div><div class="ttdeci">ailayer_t * ailayer_batch_norm(ailayer_batch_norm_t *layer, ailayer_t *input_layer)</div><div class="ttdoc">Initialize and connect the given Batch Normalization layer.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_a7047892ab2ce5b21a2581f47d8b43c60"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#a7047892ab2ce5b21a2581f47d8b43c60">ailayer_batch_norm_set_trainmem</a></div><div class="ttdeci">void ailayer_batch_norm_set_trainmem(ailayer_t *self, void *memory_ptr)</div><div class="ttdoc">Distribute provided memory to the gradients pointers.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_aa314fea512774e4b63bc25da3b030476"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#aa314fea512774e4b63bc25da3b030476">ailayer_batch_norm_print_specs</a></div><div class="ttdeci">void ailayer_batch_norm_print_specs(const ailayer_t *self)</div><div class="ttdoc">Print the layer specification.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_aca69f294f48ca9f4c474d3a75d5bb5b4"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#aca69f294f48ca9f4c474d3a75d5bb5b4">ailayer_batch_norm_sizeof_paramem</a></div><div class="ttdeci">uint32_t ailayer_batch_norm_sizeof_paramem(const ailayer_t *self)</div><div class="ttdoc">Calculate and return the parameter memory size needed for this layer.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_ae3476d9d38ffe89b267e68b1c3fc748d"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#ae3476d9d38ffe89b267e68b1c3fc748d">ailayer_batch_norm_set_paramem</a></div><div class="ttdeci">void ailayer_batch_norm_set_paramem(ailayer_t *self, void *memory_ptr)</div><div class="ttdoc">Distribute provided memory to the parameter pointers.</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_aeae1413817112d97e2c6148780e23624"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#aeae1413817112d97e2c6148780e23624">ailayer_batch_norm_calc_result_shape</a></div><div class="ttdeci">void ailayer_batch_norm_calc_result_shape(ailayer_t *self)</div><div class="ttdoc">Calculate the shape of the result tensor (ailayer.result)</div></div>
<div class="ttc" id="aailayer__batch__normalization_8h_html_af4710b2aa83d5e84bfbe259cd511f6d7"><div class="ttname"><a href="ailayer__batch__normalization_8h.html#af4710b2aa83d5e84bfbe259cd511f6d7">ailayer_batch_norm_type</a></div><div class="ttdeci">const aicore_layertype_t * ailayer_batch_norm_type</div><div class="ttdoc">Batch Normalization layer type.</div></div>
<div class="ttc" id="aaimath__f32__default_8h_html"><div class="ttname"><a href="aimath__f32__default_8h.html">aimath_f32_default.h</a></div><div class="ttdoc">Math functions for F32  data type, default implementation.</div></div>
<div class="ttc" id="astructaicore__layertype_html"><div class="ttname"><a href="structaicore__layertype.html">aicore_layertype</a></div><div class="ttdoc">Type indicator of the layer.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:82</div></div>
<div class="ttc" id="astructailayer__batch__norm_html"><div class="ttname"><a href="structailayer__batch__norm.html">ailayer_batch_norm</a></div><div class="ttdoc">General Batch Normalization layer  structure.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:75</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a05a2db6bf3cc2160f0b13c6cb3e31a18"><div class="ttname"><a href="structailayer__batch__norm.html#a05a2db6bf3cc2160f0b13c6cb3e31a18">ailayer_batch_norm::empirical_variance_channelwise</a></div><div class="ttdeci">void(* empirical_variance_channelwise)(const aitensor_t *x, int8_t channel_axis, const aitensor_t *means, aitensor_t *variances)</div><div class="ttdoc">Required math function: Channel-wise empirical variance calculation.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:145</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a0d74b4e482c87c09c71d74cce56ba157"><div class="ttname"><a href="structailayer__batch__norm.html#a0d74b4e482c87c09c71d74cce56ba157">ailayer_batch_norm::parameter_shape</a></div><div class="ttdeci">uint16_t parameter_shape[1]</div><div class="ttdoc">Shape of the parameter vectors ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:109</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a33b189c78566d57ad498dbf2cc364917"><div class="ttname"><a href="structailayer__batch__norm.html#a33b189c78566d57ad498dbf2cc364917">ailayer_batch_norm::gradients</a></div><div class="ttdeci">aitensor_t * gradients[2]</div><div class="ttdoc">Gradients of  and  for the back propagation algorithm.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:100</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a3f31c6b5eadced42f76d88aac2fbe5b6"><div class="ttname"><a href="structailayer__batch__norm.html#a3f31c6b5eadced42f76d88aac2fbe5b6">ailayer_batch_norm::d_batch_norm</a></div><div class="ttdeci">void(* d_batch_norm)(const aitensor_t *x_in, int8_t axis, const aitensor_t *means, const aitensor_t *vars, const aitensor_t *betas, const aitensor_t *gammas, const aitensor_t *delta_out, const void *eps, aitensor_t *delta_in, aitensor_t *d_betas, aitensor_t *d_gammas)</div><div class="ttdoc">Required math function: Gradients of Batch Normalization.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:204</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a4be2a7d03bb9aeca3a064739b167098a"><div class="ttname"><a href="structailayer__batch__norm.html#a4be2a7d03bb9aeca3a064739b167098a">ailayer_batch_norm::momentum</a></div><div class="ttdeci">void * momentum</div><div class="ttdoc">Momentum for the exponential moving average of means and variances.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:85</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a4cb00bf5961c120ec73810203638243e"><div class="ttname"><a href="structailayer__batch__norm.html#a4cb00bf5961c120ec73810203638243e">ailayer_batch_norm::variances</a></div><div class="ttdeci">aitensor_t * variances</div><div class="ttdoc">Vector of the variances ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:112</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a590c48e998a8a740439e38d0aa4302dd"><div class="ttname"><a href="structailayer__batch__norm.html#a590c48e998a8a740439e38d0aa4302dd">ailayer_batch_norm::optimem</a></div><div class="ttdeci">void * optimem[2]</div><div class="ttdoc">Memory field used by the trainings optimizer.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:101</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a5db4592396e5ab43fc55de673c318aae"><div class="ttname"><a href="structailayer__batch__norm.html#a5db4592396e5ab43fc55de673c318aae">ailayer_batch_norm::batch_norm</a></div><div class="ttdeci">void(* batch_norm)(const aitensor_t *x, int8_t channel_axis, const aitensor_t *means, const aitensor_t *variances, const aitensor_t *offsets, const aitensor_t *scales, const void *eps, aitensor_t *result)</div><div class="ttdoc">Required math function: Batch Normalization.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:176</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a642324fdce94ffd7d353846649fd5c3f"><div class="ttname"><a href="structailayer__batch__norm.html#a642324fdce94ffd7d353846649fd5c3f">ailayer_batch_norm::eps</a></div><div class="ttdeci">void * eps</div><div class="ttdoc">Small constant for numeric stability.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:86</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a7a06fdbdd9e5f95ddc00f8bf65297f65"><div class="ttname"><a href="structailayer__batch__norm.html#a7a06fdbdd9e5f95ddc00f8bf65297f65">ailayer_batch_norm::empirical_mean_channelwise</a></div><div class="ttdeci">void(* empirical_mean_channelwise)(const aitensor_t *x, int8_t channel_axis, aitensor_t *means)</div><div class="ttdoc">Required math function: Channel-wise empirical mean calculation.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:131</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a81edfab4c4a52c6537f3f0ee19a0d2a4"><div class="ttname"><a href="structailayer__batch__norm.html#a81edfab4c4a52c6537f3f0ee19a0d2a4">ailayer_batch_norm::gammas</a></div><div class="ttdeci">aitensor_t gammas</div><div class="ttdoc">Vector of the scale parameters ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:94</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_a88bc32827b45ca03a858d6dbc85b9a48"><div class="ttname"><a href="structailayer__batch__norm.html#a88bc32827b45ca03a858d6dbc85b9a48">ailayer_batch_norm::betas</a></div><div class="ttdeci">aitensor_t betas</div><div class="ttdoc">Vector of the shift parameters ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:93</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_ab11481f30ddb112f3febd5f656e6f238"><div class="ttname"><a href="structailayer__batch__norm.html#ab11481f30ddb112f3febd5f656e6f238">ailayer_batch_norm::means</a></div><div class="ttdeci">aitensor_t * means</div><div class="ttdoc">Vector of the means ( ).</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:111</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_ab13782a46e3804246bf82a92955096b3"><div class="ttname"><a href="structailayer__batch__norm.html#ab13782a46e3804246bf82a92955096b3">ailayer_batch_norm::base</a></div><div class="ttdeci">ailayer_t base</div><div class="ttdoc">Inherited field members from general ailayer struct.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:76</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_ab30bca8df727bfc450468830d31adf1c"><div class="ttname"><a href="structailayer__batch__norm.html#ab30bca8df727bfc450468830d31adf1c">ailayer_batch_norm::moving_variances</a></div><div class="ttdeci">aitensor_t moving_variances</div><div class="ttdoc">Vector of the moving averages of the variance (required for inference).</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:97</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_ac42e8741878f9c5f21fa033e8dc344c4"><div class="ttname"><a href="structailayer__batch__norm.html#ac42e8741878f9c5f21fa033e8dc344c4">ailayer_batch_norm::exponential_moving_average</a></div><div class="ttdeci">void(* exponential_moving_average)(const aitensor_t *new_data, const void *momentum, aitensor_t *average)</div><div class="ttdoc">Required math function: Exponential moving average.</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:158</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_ae61aaf16d54970d405095a058b233656"><div class="ttname"><a href="structailayer__batch__norm.html#ae61aaf16d54970d405095a058b233656">ailayer_batch_norm::moving_means</a></div><div class="ttdeci">aitensor_t moving_means</div><div class="ttdoc">Vector of the moving averages of the means (required for inference).</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:96</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_afcc6c64ff572ae7408fe1c4bcfe7b9d1"><div class="ttname"><a href="structailayer__batch__norm.html#afcc6c64ff572ae7408fe1c4bcfe7b9d1">ailayer_batch_norm::trainable_params</a></div><div class="ttdeci">aitensor_t * trainable_params[2]</div><div class="ttdoc">Pointer to  and  (which are the trainable parameters).</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:99</div></div>
<div class="ttc" id="astructailayer__batch__norm_html_afcee94774a3c5f173a071b67da9cc3a5"><div class="ttname"><a href="structailayer__batch__norm.html#afcee94774a3c5f173a071b67da9cc3a5">ailayer_batch_norm::channel_axis</a></div><div class="ttdeci">int8_t channel_axis</div><div class="ttdoc">Index of the channel axis (1 for channels first, -1 for channels last)</div><div class="ttdef"><b>Definition:</b> ailayer_batch_normalization.h:84</div></div>
<div class="ttc" id="astructailayer_html"><div class="ttname"><a href="structailayer.html">ailayer</a></div><div class="ttdoc">AIfES layer interface.</div><div class="ttdef"><b>Definition:</b> aifes_core.h:252</div></div>
<div class="ttc" id="astructaitensor_html"><div class="ttname"><a href="structaitensor.html">aitensor</a></div><div class="ttdoc">A tensor in AIfES.</div><div class="ttdef"><b>Definition:</b> aifes_math.h:89</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_5233a5861230ad4bc52bfd822c86fe04.html">cnn</a></li><li class="navelem"><a class="el" href="dir_a5c91e9bbf64c4b6a24d0c0102e9d7da.html">base</a></li><li class="navelem"><a class="el" href="dir_115795935351339455fee6eae515097b.html">ailayer</a></li><li class="navelem"><a class="el" href="ailayer__batch__normalization_8h.html">ailayer_batch_normalization.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
